package day20171226;

import org.apache.commons.text.similarity.CosineSimilarity;
import org.apache.commons.text.similarity.JaccardSimilarity;


import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class Similarity {
    public static void main(String[] args) {


        //E:\\hello.txt
       // E:\\学习十九大报告有感：青年当自强.doc
        try {
            FileInputStream file=new FileInputStream("E:\\学习十九大报告有感：青年当自强.doc");


            int data;

            while((data = file.read()) != -1){

                System.out.print((char) data);
            }
//            InputStreamReader reader=new InputStreamReader(file,"UTF-8");
//            BufferedReader buffer=new BufferedReader(reader);
//
//
//            String line=buffer.readLine();
//
//            while (line!=null){
//                System.out.println(line);
//                line=buffer.readLine();
//            }


/*
            CosineSimilarity cosineSimilarity = new CosineSimilarity();



            double cosSimilary = cosineSimilarity.cosineSimilarity(leftVector,rightVector);
            System.out.println("余弦相似度:"+cosSimilary);
           // System.out.println(result);


            JaccardSimilarity jaccardSimilarity = new JaccardSimilarity();
            double jcdsimilary1 = jaccardSimilarity.apply(result, rs);

            System.out.println("jaccard相似系数:"+jcdsimilary1);*/
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
